# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Allan McRae <mcrae_allan@hotmail.com>
# Contributor: lp76 <l.peduto@gmail.com>

pkgname=gtk-vnc
pkgver=1.3.1
pkgrel=1
pkgdesc="VNC viewer widget for GTK"
url="https://wiki.gnome.org/Projects/gtk-vnc"
arch=(x86_64)
license=(LGPL)
depends=(libgcrypt gtk3 gnutls libpulse)
makedepends=(vala gobject-introspection git perl-text-csv meson)
provides=(libgtk-vnc-2.0.so libgvnc{,pulse}-1.0.so)
options=(debug)
_commit=1ea35aa11bdf97916409504024bcd36a01abc64d  # tags/v1.3.1^0
source=("git+https://gitlab.gnome.org/GNOME/gtk-vnc.git#commit=$_commit"
        "git+https://gitlab.com/keycodemap/keycodemapdb.git")
sha256sums=('SKIP'
            'SKIP')

pkgver() {
  cd gtk-vnc
  git describe --tags | sed 's/^v//;s/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd gtk-vnc

  git submodule init
  git submodule set-url src/keycodemapdb "$srcdir/keycodemapdb"
  git submodule update
}

build() {
  arch-meson gtk-vnc build
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"
  install -Dt "$pkgdir/usr/bin" build/examples/gvncviewer
}
